﻿@{
    ViewData["Title"] = "问题记录";
}

<div class="panel panel-default">
    <div class="form-content">
        <div class="form-body">
            <div id="filter" class="row" data-filterable="true" data-toggle="form" data-field="Issue" data-grid="#grid" style="padding: 5px 0;">
                <input data-field="Name,Code,Item.Name,Item.Code" data-size="4,0,12" data-logic="or" data-operator="contains" />
                <button data-button="query">查询</button>
                <button data-button="clear">清除条件</button>
                <div class="pull-right" style="padding-right:15px;">
                    <button data-button="add" data-popup="IssueEdit">新 增</button>
                </div>
            </div>
            <div id="grid" data-toggle="grid" data-form="#filter" node="grid" data-related='#_PopupIssueDetail'>
                <div node="columns" node-type="array">
                    <span data-field="Name" data-title="问题名称"></span>
                    <span data-field="Code" data-title="问题编号"></span>
                    <span data-field="Item.Name" data-title="工作事项名称"></span>
                    <span data-field="Item.Code" data-title="工作事项编号"></span>
                    <span data-field="IssueType" data-title="问题类型" data-template="#:data=>$.com.commonFormatter(cache.issueTypes, data.IssueType)"></span>
                    <span data-field="IssueState" data-title="问题状态" data-template="#:data=>$.com.commonFormatter(cache.issueStates, data.IssueState)"></span>
                    <span data-field="Description" data-title="备注说明"></span>
                    <span data-field="CreatedOn" data-title="创建时间" data-type="date"></span>
                </div>
                <span node="dataSource">
                    <span node="transport">
                        <span node="read" data-url="/odata/Issues?$expand=Item($select=Id,Name,Code)">
                        </span>
                    </span>
                </span>
            </div>
        </div>
    </div>
</div>

<div id="_PopupIssueDetail" data-toggle="popup" data-type="IssueDetail" data-title="问题信息" data-size="large">
    <div class="popup-content" data-toggle="form" data-field="Issue" data-detailable="true" data-size="6,4,8">
        <div class="popup-body">
            <div class="form-content">
                <div class="form-heading">
                    <span>问题信息</span>
                </div>
                <div class="form-body">
                    <span data-field="Name" data-label="问题名称"></span>
                    <span data-field="Code" data-label="问题编号"></span>
                    <span data-field="Item.Name" data-label="工作事项名称"></span>
                    <span data-field="Item.Code" data-label="工作事项编号"></span>
                    <span data-field="IssueType" data-label="问题类型" data-formatter="#:el=>$.com.commonFormatter(cache.issueTypes, el.options.value)"></span>
                    <span data-field="IssueState" data-label="问题状态" data-formatter="#:el=>$.com.commonFormatter(cache.issueStates, el.options.value)"></span>

                    <div class="row">
                        <span data-field="Description" data-label="备注说明" data-size="12,2,8"></span>
                        <div data-label="附件" data-field="Attachments" data-size="12,2,10" data-type="img" data-with-attachments="true" data-business-type="Issue"></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="popup-footer text-right">
            <button data-button="edit" data-popup="IssueEdit">编 辑</button>
            <button data-button="close">关 闭</button>
        </div>
    </div>
</div>

<div id="_PopupIssueEdit" data-toggle="popup" data-type="IssueEdit" data-title="问题信息" data-related="#filter" data-size="large">
    <div class="popup-content" data-toggle="form" data-field="Issue" data-editable="true" data-url="/odata/Issues" data-size="12,3,8" data-ignore-fields="Item">
        <div class="popup-body">
            <div class="form-content">
                <div class="form-heading">
                    <span>问题信息</span>
                </div>
                <div class="form-body">
                    <input data-field="Name" data-label="问题名称" required />
                    <input data-field="Code" data-label="问题编号" required />
                    <select data-field="ItemId" data-label="工作事项" data-role="kendoDropDownList" data-side="server" data-url="/odata/Items?$select=Id,Name" data-data-value-field="Id" data-data-text-field="Name" required></select>
                    <span data-field="IssueType" data-label="问题类型" type="radio" data-with-group="true" data-data="#:cache.issueTypes" data-value="General"></span>
                    <span data-field="IssueState" data-label="问题状态" type="radio" data-with-group="true" data-data="#:cache.issueStates" data-value="Opened"></span>
                    <textarea data-field="Description" data-label="备注说明" rows="5" data-multiple="true"></textarea>
                    <div class="col-md-offset-3">
                        <input data-field="Attachments" data-label="请选择附件" data-with-attachments="true" data-business-type="Issue" data-role="kendoUpload" type="file" data-file-count="10" data-file-size="4096" data-file-extension=".jpg,.jpeg,.png" />
                    </div>
                </div>
            </div>
        </div>
        <div class="popup-footer text-right">
            <button data-button="post" data-success-text="新增成功">新 增</button>
            <button data-button="put" data-success-text="保存成功">提 交</button>
            <button data-button="delete" data-success-text="删除成功">删 除</button>
            <button data-button="close">关 闭</button>
        </div>
    </div>
</div>

<partial name="../Template/_Attachment" />